

#import "XMTabBarViewController.h"
#import "XMTabBarView.h"
#import "XMNavigationController.h"
@implementation XMTabBarViewController

- (instancetype)init {
    if (self = [super init]) {
        XMTabBarView *tabBarView = [[XMTabBarView alloc] init];
        tabBarView.backgroundColor = [UIColor whiteColor];
        self.tabBarView = tabBarView;
        XMWeakSelf(self);
        tabBarView.switchTabBar = ^(NSInteger index) {
            XMStrongSelf(self);
            [self switchTabBarIndex:index];
        };
        tabBarView.repeatSwitchTabBar = ^(NSInteger index) {
        };
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self addChildViewController:[[XMNavigationController alloc] initWithRootViewController:[[NSClassFromString(@"XMHomeViewController") alloc] init]]];

    [self addChildViewController:[[XMNavigationController alloc] initWithRootViewController:[[NSClassFromString(@"XMFindViewController") alloc] init]]];

    [self addChildViewController:[[XMNavigationController alloc] initWithRootViewController:[[NSClassFromString(@"XMConversationListViewController") alloc] init]]];

    [self addChildViewController:[[XMNavigationController alloc] initWithRootViewController:[[NSClassFromString(@"XMMineViewController") alloc] init]]];

    [self setSelectedIndex:0];
}

@end
